<div *ngIf="carrier" class="form-horizontal">
    <form #carrierform="ngForm" novalidate>
    <div class="row">
        <div class="form-group col-sm-6">
            <label class="form-control-label">ID:</label>
            <input name="carrier_id" [(ngModel)]="carrier.carrier_id" placeholder="承运商ID" class="form-control" readonly />
        </div>
        <div class="form-group col-sm-6">
            <label class="form-control-label">承运商名称:</label>
            <input name="carrier_name" #carrier_name="ngModel" [(ngModel)]="carrier.carrier_name" placeholder="承运商名称" class="form-control" required />
            <span style="color:red" [hidden]="carrier_name.valid || carrier_name.pristine">
                名称不能为空。
            </span>
        </div>
    </div>
    <div class="row">
        <div class="form-group col-sm-6">
            <label class="form-control-label">地址:</label>
            <input name="address" [(ngModel)]="carrier.address" placeholder="地址" class="form-control" />
        </div>
        <div class="form-group col-sm-6">
            <label class="form-control-label">联系人:</label>
            <input name="contact_name" [(ngModel)]="carrier.contact_name" placeholder="联系人" class="form-control" />
        </div>
    </div>
    <div class="row">
        <div class="form-group col-sm-6">
            <label class="form-control-label">联系电话:</label>
            <input #contact_mobile="ngModel" name="contact_mobile" [(ngModel)]="carrier.contact_mobile" placeholder="联系电话" class="form-control" 
            pattern="(\d{11})|^((\d{7,8})|(\d{4}|\d{3})-(\d{7,8})|(\d{4}|\d{3})-(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1})|(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1}))$"/>
            <span style="color:red" [hidden]="contact_mobile.valid || contact_mobile.pristine">
                电话格式不正确。
            </span>
        </div>
        <div class="form-group col-sm-6">
            <label class="form-control-label">是否有效:</label>
            <select name="status" class="form-control" id="status" [(ngModel)]="carrier.status">
                <option>YES</option>
                <option>NO</option>
            </select>
        </div>
    </div>
    <div class="row">
        <div class="form-group">
            <!--<div class="col-sm-1">
                <button class="btn btn-danger" *ngIf="carrier.carrier_id" (click)="delete()">删除</button>
            </div>-->
            <div class="offset-sm-9 col-sm-1">
                <button class="btn btn-default" (click)="cancel()">取消</button>
            </div>
            <div class="col-sm-1">
                <button [disabled]="!carrierform.form.valid" class="btn btn-primary" (click)="save()">保存</button>
            </div>
        </div>
    </div>
    </form>
</div>